import { watch } from "vue";

export default function openStrictCheck(store) {
  // watch是异步的，我们需要同步的监听，保证只能在mutation中同步代码保证单线程来监听是否是通过mutation来更改
  watch(
    () => store._state.data,
    () => {
      console.assert(
        store.mutationing,
        "严格模式下，不建议直接修改state，只能通过mutation或者action更改"
      );
    },
    { deep: true, flush: "sync" }
  );
}
